import request from "../utils/request"

export function searchStaff(data) {
  return request({
    url: '/staff',
    method: 'get',
    params: {
      pageSize: data.pageSize,
      pageNum: data.pageNum,
      name: data.name,
    }
  })
}

// get single staff information
export function fetchStaffDetail(staffID) {
  return request({
    url: `/staff/${staffID}`,
    method: 'get',
  })
}



// add staff information
export function addStaff(data) {
  return request({
    url: '/staff',
    method: 'post',
    data
  })
}

// update staff
export function updateStaff(data) {
  return request({
    url: '/staff',
    method: 'put',
    data
  })
}

//下载大纲与测试用例
export function downloadDocx(data) {
  return request({
    url: '/service/downloadDocx',
    method: 'get',
    params: {
      taskID: data.taskID
    },
    responseType: 'blob',   //返回类型是blob，才能返回文件
    emulateJSON: true,
  })
}

//上传附件
export function uploadAdvice(data) {
  return request({
    url: '/service/uploadAdvice',
    method: 'post',
    headers: {
      // 'Content-Type': 'application/x-www-form-urlencoded'
      'Content-Type': 'multipart/form-data'
    },
    data
  })
}
